#define _CRT_SECURE_NO_WARNINGS

#include "stack.h"

void TestStack1()
{
    Stack st;
    StackInit(&st);
    if (StackEmpty(&st))
    {
        puts("nullptr");
    }

    StackPush(&st, 1);
    StackPush(&st, 2);
    StackPush(&st, 3);
    StackPush(&st, 4);
    StackPush(&st, 5);
    StackPush(&st, 6);
    StackPush(&st, 7);
    StackPush(&st, 8);
    printf("%d\n\n", StackSize(&st));

    StackDestory(&st);
}

void TestStack2()
{
    Stack st;
    StackInit(&st);

    StackPush(&st, 1);
    StackPush(&st, 2);
    StackPush(&st, 3);
    StackPush(&st, 4);
    StackPush(&st, 5);
    if (StackEmpty(&st))
    {
        puts("nullptr\n");
    }

    //while(!StackEmpty(&st))
    while (StackSize(&st))
    {
        printf("%d ", StackTop(&st));
        StackPop(&st);
    }

    puts("");
    StackDestory(&st);
}

int main()
{
    TestStack1();
    TestStack2();

    return 0;
}
